<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user', function (Blueprint $table) {

            $table->bigIncrements('id');

            $table->timestamps();

            $table->string('phone')->comment('用户手机号，用户唯一标识');

            $table->unique('phone');

            $table->string('img')->default('')->comment('头像');

            $table->string('nickname')->nullable()->comment('昵称');

            $table->unique('nickname');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user');
    }
}
